Skip to content

🚀 [Feature]: Repository file and directory contents now retrievable#307

Open
Marius Storhaug (MariusStorhaug) wants to merge 7 commits intomainfrom
ToolDescriptor
Open

🚀 [Feature]: Repository file and directory contents now retrievable#307
Marius Storhaug (MariusStorhaug) wants to merge 7 commits intomainfrom
ToolDescriptor

Conversation

@MariusStorhaug
Copy link
Copy Markdown
Member

@MariusStorhaug Marius Storhaug (MariusStorhaug) commented Feb 10, 2025

Repository file and directory contents can now be retrieved directly from PowerShell. A new Get-GitHubRepositoryContent command returns the contents of a file or directory at a given path and optional ref (branch, tag, or commit SHA).

New: Retrieve repository file and directory contents

Get-GitHubRepositoryContent returns metadata and content for files, or a listing for directories, in a GitHub repository. By default it returns the repository root. Use -Path to target a specific file or directory, and -Ref to specify a branch, tag, or commit.

# Get the root directory listing
Get-GitHubRepositoryContent -Owner 'octocat' -Repository 'Hello-World'

# Get a specific file from a branch
Get-GitHubRepositoryContent -Owner 'octocat' -Repository 'Hello-World' -Path 'README.md' -Ref 'main'

# Get contents at a specific tag
Get-GitHubRepositoryContent -Owner 'octocat' -Repository 'Hello-World' -Path 'src' -Ref 'v1.0.0'

Technical Details

  • New public function Get-GitHubRepositoryContent calls GET /repos/{owner}/{repo}/contents/{path} with optional ref query parameter.
  • Coverage.md updated to mark /repos/{owner}/{repo}/contents/{path} GET and /repos/{owner}/{repo}/readme GET as covered.
  • Tests added for file retrieval, root directory listing, non-existent file error, and feature branch retrieval.
  • tools/Get-GitHubAPIDescriptor.ps1 and tools/utilities/ helpers added for API discovery tooling (non-shipped).

@MariusStorhaug Marius Storhaug (MariusStorhaug) changed the title 🩹 [Patch]: Add Get-GitHubAPIDescriptor and Get-GitHubRepositoryContent 🚀 [Feature]: Repository file and directory contents now retrievable Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Add function to retrieve GitHub OpenAPI spec as an object

1 participant